#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
from time import localtime,strftime

for line in sys.stdin:
    items=line.strip().split("\001",-1)
    if len(items) > 41:
        cid=items[0] if items[0] else "-"
        sid=items[1] if items[1] else "-"
        if cid == "-" or sid == "-":
            continue
        eventid=items[6]
        timestamp=items[17] if items[17] else "0"
        x=localtime(long(timestamp)/1000)
        day=strftime('%Y%m%d',x)
        session=items[41] if items[41] else "-"
        nasid=items[29] if items[29] else "-"
        ep=items[2] if items[2] else "-"

        ip=items[5] if items[5] else "-"
        sis=items[43].strip() if items[43].strip() and items[43].strip() != "None" else "-"
        sisurl=items[44].strip() if items[44].strip() else "-"
        referer_type=items[37].strip() if items[37].strip() else "-"

        # cid,aid,day,nasid,cookie,ep,timestamp,ip=line.strip().split("\t",-1)
        print session+"\t"+timestamp+"\t"+cid+"\t"+sid+"\t"+day+"\t"+nasid+"\t"+ep+"\t"+ip+"\t"+sis+"\t"+sisurl+"\t"+referer_type+"\t"+eventid